package com.job.yangshida.homework11and12.homework0712;

import java.util.Random;

/**
 * @author 杨士达
 * @version 1.0
 * @since 2022-07-13 13:53:01
 */
public class Factory {
    public static Attack getAttack(String n) {
        if (n.equals("1")){
            return new Attack1();
        }else if (n.equals("2")){
            return new Attack2();
        }else if (n.equals("3")){
            return new Attack3();
        }
        else {
           return new Attack() {
               @Override
               public void attack() {
                   System.out.println("随便攻击"+new Random());// .nextInt(10));
               }
           };
        }
    }
}
